package cn.com.yang.egg;

import java.util.LinkedList;

public class TestQueue {
	LinkedList<Integer> stack1=null;
	LinkedList<Integer> stack2 =null;
	public TestQueue() {
		stack1 = new LinkedList<Integer>();
		stack2 = new LinkedList<Integer>();
		
	}
	public void appendTail(int value) {
		stack1.add(value);
	}
	
	public int deleteHead() {
		if (stack2.isEmpty()) {
			if (stack1.isEmpty()) return -1;
			while (!stack1.isEmpty()) {
				stack2.add(stack1.pop());
			}
			return stack2.pop();
		} else return stack2.pop();
	}
}
